package com.zhong.gang.applib.http.callback;

import android.app.Activity;
import android.content.Context;
import android.util.Log;


import androidx.fragment.app.Fragment;

import com.luck.picture.lib.tools.ToastUtils;
import com.zhong.gang.applib.http.BaseDataBean;

import okhttp3.Call;

public class DataCallBack<M extends BaseDataBean> extends DataBaseBeanCallback<M > {
    public DataCallBack(Activity activity) {
        super(activity);
    }

    public DataCallBack(Fragment fragment) {
        super(fragment);
    }
    public DataCallBack() {
        super();
    }

    @Override
    public void onError(String str) {
        if (context !=null)
            ToastUtils.s(context,str);
    }

    @Override
    public void onResponse(M data) throws Exception {
        if (context != null)
            ToastUtils.s(context,data.getMessage());
    }

    @Override
    public void onError(Call call, Exception e, int id) {
        super.onError(call, e, id);
        Log.e("==``",e.toString());
        if (context!= null)
            ToastUtils.s(context,e.getMessage());
    }
}
